<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

    <div id="app">
        <user></user>
    </div>

    <div id="app2">
        <user/>
    </div>

    <script src="js/vue.js"></script>
    <script>
        new Vue({
            el:"#app",
            components:{
                "user":{
                    template: `
                    <div>
                        <h3>hello!!!{{msg}}</h3>
                        <button @click="addMsg">点击+1</button>
                    </div>
                    `,
                    data(){
                        return {
                            msg:1
                        }
                    },
                    methods:{
                        addMsg(){
                            this.msg++;
                        }
                    }
                }
            },
        })

        new Vue({
            el:"#app2",
        })
    </script>
</body>
</html>